const fs=require("fs");
const bodyParser=require("koa-bodyparser");

const router=require("koa-router")();

const koa=require("koa")
const app=new koa();

router.get("/login",async (ctx,next)=>{
    let data=fs.readFileSync("./koa-bodyparser1.html");
    ctx.response.type="text/html";
    ctx.response.body=data;
})
router.post("/tologin",async (ctx,next)=>{
    let username=ctx.request.body.username;
    let password=ctx.request.body.password;
    ctx.response.body="欢迎${username}"
})
app.use(bodyParser())
app.listen(3000,()=>{
    console.log("服务器启动成功")
    console.log('app started at port 3000...');
})
